package com.aosd.project.aonotepad.domain;

import java.util.List;

import com.aosd.project.aonotepad.domain.file.File;
import com.aosd.project.aonotepad.domain.search.SearchFilter;

public class Workspace 
{
	private String name;
	private String path;
	private List<Note> notes;
	private List<Note> openNotes;
	
	public void addNote(Note n)
	{
		notes.add(n);
		openNotes.add(n);
	}
	
	public void removeNote(Note n)
	{
		notes.remove(n);
	}
	
	public Workspace(String path)
	{
		this.path = path;
		
		// load operation here
		
		// start save timer here.
		
	}
	
	public Note open(File f)
	{
		Note n = f.open();
		openNotes.add(n);
		
		// notify "UI" observers, here ? 
		return n;
	}
	
	public List<Note> findOnNotes(SearchFilter filter)
	{
		return filter.find(notes);
	}
	
	public List<Note> findOnOpenedNotes(SearchFilter filter)
	{
		return filter.find(openNotes);
	}
	
	
	
	
}
